import { BasicColumn, FormSchema } from '@/components/Table';
import { h } from 'vue';
import {Image, Switch} from 'ant-design-vue';
import {getLevelSelectsApi, getCategorySelectsApi} from '@/api/sys/common';

import { useMessage } from '@/hooks/web/useMessage';

type CheckedType = boolean | string | number;
export const columns: BasicColumn[] = [
  {
    title: '分类名称',
    dataIndex: 'categoryName',
  },
  {
    title: '排序',
    dataIndex: 'sort',
    width: 100,
  },
  {
    title: '图片',
    dataIndex: 'img',
    width: 180,
    customRender: ({ record }) => {

      let img = record.img;

      return h(Image, {
        "width":50,
        "height":50,
        "src":img
      } );
    },
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
  },

];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'keyword',
    label: '分类名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'categoryName',
    label: '分类名称',
    required: true,
    component: 'Input',
  },
  {
    label: '排序',
    field: 'sort',
    component: 'Input',
  },
  {
    label: '网络图片',
    field: 'img',
    component: 'Input',
  },
];
